package com.dream.myqiyi.ui;

import com.dream.myqiyi.R;
import com.dream.myqiyi.util.PictureUtil;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

/**
 * Activity
 *
 * @author C.M.
 *
 */
public class FlipperActivity extends BaseActivity {
	//public static final String RENREN_NEWFEED_TYPE = "10,11,20,21,22,23,30,31,32,33,34,35,36,40,41,50,51,52,53,54,55";
	//public static final String RENREN_STATUS_TYPE = "10,11";
	protected ImageView mMenu = null;
	protected RelativeLayout mModeLayout = null;
	protected TextView mTitle = null;
	protected ImageView mFunction_1 = null;
	protected ImageView mFunction_2 = null;
	protected ImageView mFunction_3 = null;
	protected ListView mDisplay = null;
	protected ProgressBar mBar = null;
	//protected LoadingDialog dialog = null;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.flipper);
		//dialog = new LoadingDialog(this, R.style.dialog);
		mMenu = (ImageView) findViewById(R.id.flipper_menu);
		mModeLayout = (RelativeLayout) findViewById(R.id.flipper_mode_layout);
		mTitle = (TextView) findViewById(R.id.flipper_mode_text);
		mFunction_1 = (ImageView) findViewById(R.id.flipper_function_1);
		mFunction_2 = (ImageView) findViewById(R.id.flipper_function_2);
		mFunction_3 = (ImageView) findViewById(R.id.flipper_function_3);
		mDisplay = (ListView) findViewById(R.id.flipper_display);
		mBar = (ProgressBar) findViewById(R.id.flipper_progressbar);

		mMenu.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				OpenDesktoop();
			}
		});
		mDisplay.setOnItemClickListener(new OnItemClickListener() {

			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {

			}
		});
	}
	public void onBackPressed() {
		OpenDesktoop();
	}

	/**
	 *
	 */
	protected void OpenDesktoop() {
		PictureUtil.prepare(this, R.id.flipper_layout);
		startActivity(new Intent(this, MainActivity.class));
		overridePendingTransition(0, 0);
		//this.finish();
	}

	/**
	 *
	 */
	protected void showDialog() {
		//dialog.show();
	}

	/**
	 *
	 */
	protected void dismissDialog() {
//		if (dialog.isShowing()) {
//			dialog.dismiss();
//		}
	}

	protected void onDestroy() {
		super.onDestroy();
		dismissDialog();
	}
}
